home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 60.zip
/
BS1 part 60
/
Imagemaster d5.adf
/
piarc.lzh.parta
/
BMRD.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-03-22
|
5KB
|
136 lines
/*
* BMRD.rexx
*
* Written by: Pete Patterson & Ben Williams
* Last Update: February 27th, 1993
* For: Black Belt Systems Amiga image processing software "IM"
* --------------------------------------------------------------------
* Revision: 2.00
*/
parse arg fullname
call pragma('stack',20000);
if ~show('L',"rexxsupport.library") then do
if ~addlib('rexxsupport.library',0,-30,0) then do
say 'We Have A Library Problem, Unable To Load "rexxsupport.library"';
say 'Cannot operate PI Modules without this library - sorry!';
'finish';
exit 10;
end;
end;
prtnme = 'IP_Port'; /* assume Image Professional */
if show('P','IP_Port') = 0 then do
if show('P','IM_Port') = 0 then do
say "Can't find image processor's ARexx port!!!"; /* not running? */
say "This script requires IP, IM or IM F/c to run!";
exit(20);
end;
else do
prtnme = 'IM_Port';
end;
end;
cmdpath = 'c:';
if open(fhandle,'rexx:picmdpath','read') then
do
cmdpath = readln(fhandle);
call close(fhandle);
end
if fullname = "" then
do
options results;
address command 'rx rxpi:GetFile.rexx';
if open(fhandle,'ram:IP_FNAME.tmp','read') then
do
fullname = readln(fhandle);
call close(fhandle);
end
end
thispath = gimmepath(fullname);
/* --------------------------------------------------------------------- */
/* ------------- BEGINNING of format-specific ARexx code --------------- */
/* --------------------------------------------------------------------- */
address command cmdpath||'BMRD c "'||fullname||'"';
if rc ~= 0 then do; address(prtnme); 'message "Cannot read '||fullname||' Error = '||rc||'"'; 'finish'; exit 0; end;
call open(fhandle,'ram:IP_BMRD.tmp','read'); rstring = readln(fhandle); call close(fhandle);
parse var rstring width '/' height '/' depth
address command 'c:delete >nil: ram:IP_BMRD.tmp';
if height < 0 then do; 'message "Bad Height:' height '"'; 'finish'; exit 0; end;
if height > 32767 then do; 'message "Bad Height:' height '"'; 'finish'; exit 0; end;
if width < 0 then do; 'message "Bad Width:' width '"'; 'finish'; exit 0; end;
if width > 32767 then do; 'message "Bad Width:' width '"'; 'finish'; exit 0; end;
if depth < 2 then do; 'message "Bad Depth:' depth '"'; 'finish'; exit 0; end;
if depth > 4 then do; 'message "Bad Depth:' depth '"'; 'finish'; exit 0; end;
if depth = 2 then do
options results; 'gadgets "Pads","Only","Silk","Layer","Layer","One","Layer","Two"'; pxsz = result-1; options;
if pxsz < 0 then do; 'finish'; exit 0; end;
end
else do
options results; 'gadgets "Pads","Only","Silk","Layer","Layer","One","Layer","Two","Layer","Three","Layer","Four"'; pxsz = result-1; options;
if pxsz < 0 then do; 'finish'; exit 0; end;
end
address(prtnme);
'imtofront';
'autoredraw 0';
options results;
'newtargetted '||width||' '||height||' "'||gxname||'"'
if rc ~= 0 then do; 'options'; "message Can't allocate buffer!"; 'autoredraw 1'; 'finish'; exit 0; end;
bnum = result;
'backin '||bnum;
plugadr = result;
options;
'lockimage '||bnum;
address command cmdpath||'BMRD d'||plugadr||' "'||fullname||'" '||pxsz;
'unlockimage '||bnum;
'imtofront';
'autoredraw 1';
'finish';
exit 0;
/* --------------------------------------------------------------------- */
/* ---------------- END of format-specific ARexx code ------------------ */
/* --------------------------------------------------------------------- */
gimmepath:
arg fullnamegx;
tempgx = reverse(fullnamegx);
lengx = length(fullnamegx); /* get length of string */
slashdex = index(tempgx,'/'); /* first occurance of '/' from right */
colondex = index(tempgx,':'); /* first occurance of ':' from right */
seploc = 0; /* assumes current dir, no path supplied */
if slashdex ~= 0 then do /* we assume we are in a DIR */
seploc = (lengx - slashdex)+1;
end;
else do
if colondex ~= 0 then do /* we assume we are on a device */
seploc = (lengx - colondex)+1;
end;
end;
gxname = substr(fullnamegx,seploc+1); /* if you ever need it */
gxpath = left(fullnamegx,seploc);
return(gxpath);
expandfilename:
parse arg jfile;
if index(jfile,':') = 0 then do
curdir = pragma(D);
if right(curdir,1) ~= ':' then do
if right(curdir,1) ~= '/' then do
if curdir ~= '' then do
curdir = curdir || '/';
end;
end;
end;
jfile = curdir||jfile;
end;
return(jfile);